#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include <FixedFloat.h>
#include <Common.h>

USING_MOCKCPP_NS USING_TESTNGPP_NS

FIXTURE(FixedFloat)
{
    TEST("FixedFloat<-2>(5.3987)+FixedFloat<-2>(5.937) = 11.32")
    {
        LengthFloat length1(5.3987), length2(5.937);

        ASSERT_EQ(11.32, (double)(length1+length2));

    }

    TEST("FixedFloat<-2>(5.3987)*FixedFloat<-2>(5.937) = 31.96")
    {
        LengthFloat length1(5.3987), length2(5.937);

        ASSERT_EQ(31.96, (double)(length1*length2));

    }

    TEST("FixedFloat<-2>(74.99)*FixedFloat<-2>(2.5) = 187.48")
    {
        LengthFloat length1(74.99), length2(2.5);

        ASSERT_EQ(187.48, (double)(length1*length2));

    }

    TEST("assert length in (0,100] should be true")
    {
        LengthFloat min(0), max(100.0);

        double tstData[] =
        {   0.01,100};

        for(int i=0;i<sizeof(tstData)/sizeof(double);i++)
        {
            LengthFloat length(tstData[i]);
            ASSERT_TRUE( length>min && length<=max);
        }
    }

};

